Skip to content

id: joined builder/moderator session frames (design #835 phase 3) - #8494

Merged
dezren39 merged 3 commits into
mainfrom
queue/14374-8036-joined-frames
Nov 11, 2026
Merged

dezren39 merged 3 commits into
mainfrom
queue/14374-8036-joined-frames

Conversation

@dezren39

@dezren39 dezren39 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Closes #8036 — design #835 phase 3, the session half (phases 1–2 landed in #4535 and #8034: the journal gate and the actor-authorized operations). A joined session can now act on its live capability instead of the admin secret.

What changed

Joined builder install (install_begin in a joined session)

  • admin_token is now optional on the frame. A joined install_begin that omits it installs on the session capability's authority; one that carries it is refused as mixed credentials before any scope check. The pre-join admin path is unchanged, except a missing token there is now refused explicitly ("module install denied") instead of failing the admin comparison.
  • New WorldService::install_wasm_authorized: early BUILDER check before any upload bytes are received, then the admin path's exact safeguards (the chunk loop is now a shared receive_module_upload), the publisher trust gate, module-directory save, blob pin — and the actor's own re-check at the effect boundary in install_program_authorized, which derives the BuilderInstalled { by } audit actor from the capability. No session-supplied value names the actor.
  • Builder installs are Wasm-only: a native artifact gets InvalidModule even on hosts with native execution enabled, so builder authority can never reach the native installer.

Joined moderator revoke (new revoke client frame)

  • Carries only participant_id; handled via revoke_authorized (phase 2), so the journal's Revoked { by } is actor-derived. Success — and the no-op inactive-target case (revoked: false, no journal record) — replies with the new revoked server frame. The victim's session is closed by the existing revocation broadcast.

Stable denial code

  • ServerFrame::Error gains an optional code, omitted for every existing error (serialized shape unchanged). Joined role denials use exactly actor_denied — one non-oracular code for invalid, expired, revoked, and insufficient capabilities, mirroring the CapError code from the capability layer.
  • New WorldCommand::AuthorizeScope / WorldHandle::authorize lets session paths classify a denial before doing work (before receiving upload bytes; before attempting a revoke). The operation commands still re-check inside the actor, so a capability revoked mid-upload is refused at the boundary — covered by a test that revokes the builder after upload_ready and asserts no activation and no BuilderInstalled journal entry.

Shell contract revision 6 — install_begin phases add joined and admin_token becomes string?; revoke (admin class, joined) and revoked (reply) frames named; error gains code: string?. The CLI contract-check expectation moves to v1.6 with it.

Tests

Eight new SessionIo tests in world_session::tests: builder install + journal attribution + program live; guest install denied actor_denied with session surviving; mixed credentials; mid-upload revocation; native upload refused; pre-join token omission; moderator revoke + victim disconnect + journal attribution + no-op re-revoke; guest revoke denied.

  • cargo test --lib -- world_session:: shell_contract:: — 79 passed
  • cargo test --lib -- world:: — 274 passed
  • cargo test --test world_roles — 7 passed

Worked by the repo-health queue worker (lane code-g, task 14374) from the phase-3 scope in #8036 and design doc/2026-11-01_design_id835.md §5.


🤖 agent-note:v1 — queue task 14374 (lane code-g). Phase 3 of design #835; phases 1–2 already merged (#4535, #8034).


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Implements #8036, the session half of design #835 phases 3: a joined
session can now act on its live capability instead of the admin secret.

- install_begin accepts an omitted admin token in joined sessions and
  installs through the new WorldService::install_wasm_authorized: an
  early BUILDER scope check before bytes are received, the admin
  path's upload safeguards (shared receive_module_upload), the module
  trust gate, and the actor's own re-check at the effect boundary via
  install_program_authorized, which derives the BuilderInstalled audit
  actor from the capability. A joined frame carrying an admin token is
  refused as mixed credentials; the pre-join path is unchanged and now
  refuses a missing token explicitly. Builder installs are Wasm-only:
  a native artifact is refused even where native execution is enabled.
- New joined revoke frame: a moderator's session revokes a participant
  through revoke_authorized; the audit actor is derived inside the
  actor, never from the frame. Success (or a no-op inactive target)
  replies with the new revoked server frame.
- Denials of joined role actions carry the stable actor_denied code on
  the error frame (new optional field; omitted for every existing
  error, whose serialized shape is unchanged). The world actor gains
  WorldCommand::AuthorizeScope / WorldHandle::authorize so session
  paths can classify a denial before doing work; the authorized
  operation commands still re-check at the boundary.
- Shell contract revision 6: install_begin phases add joined and its
  admin_token becomes optional, revoke (admin, joined) and revoked
  (reply) frames are named, error gains the optional code field.

Tests: eight new SessionIo tests cover builder install with journal
attribution, guest install/revoke actor_denied denials, mixed
credentials, mid-upload revocation, native refusal, pre-join token
omission, and moderator revoke with disconnect + journal attribution.
world_session + shell_contract 79 passed; world:: 274 passed;
tests/world_roles 7 passed.
@dezren39
dezren39 requested a review from a team as a code owner November 11, 2026 03:28
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 43 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 81a4a634-7d5c-4109-a972-5f98963f42c2
Commits

Reviewing files that changed from the base of the PR and between 062bbba and 6f28758.

Files selected for processing: 13

  • pkgs/id/contract/shell-contract.v1.json
  • pkgs/id/src/commands/world.rs
  • pkgs/id/src/shell_contract.rs
  • pkgs/id/src/shell_contract/tests.rs
  • pkgs/id/src/world/actor.rs
  • pkgs/id/src/world/core.rs
  • pkgs/id/src/world/handle.rs
  • pkgs/id/src/world/mod.rs
  • pkgs/id/src/world_session/mod.rs
  • pkgs/id/src/world_session/service.rs
  • pkgs/id/src/world_session/tests.rs
  • pkgs/id/src/world_session/types.rs
  • pkgs/id/tests/world_roles.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T05:39:14.221278Z 6f28758 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0ae5e39a8d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +224 to 225
"phases": ["opening", "joined"],
"opens": "install",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Track joined uploads in the conformance state machine

For a valid joined builder upload, Conformance::client in src/shell_contract.rs remains in Phase::Joined after install_begin: it only applies a frame's opens transition in Phase::Opening. Consequently, the subsequent install_chunk and install_end frames are rejected because their contract phases are exclusively install, and check_contract rejects transcripts produced by the newly supported flow. Update the conformance state machine to enter the upload phase from a joined session and return to joined, rather than closed, when that upload ends.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cdd39d5 (head now 6f28758, which also merges current main).

Conformance now records the phase an upload returns to when the upload opens: install_begin from Joined enters Install with return phase Joined; install_end returns there instead of Closed, and a refusal error during the upload returns there too (a refused joined upload does not end the session). Only an upload opens a phase from Joined — the opens values on joined query/admin frames stay non-transitional, as the existing joined-session conformance tests require.

Coverage: new shell_contract assertions run the joined upload sequence (join → install_begin → upload_ready → install_chunk → install_end → chat) and the refused variant (error instead of upload_ready), both conforming and ending in Joined. cargo test -p id --lib: 2648 passed; the only failure is the pre-existing frames::tests::byte_refusal... breakage tracked in #8354, which fails identically on pristine main.

Comment thread pkgs/id/src/world_session/mod.rs Outdated
Comment on lines +818 to +823
.install_program_authorized(
token,
module_hash.clone(),
seed,
Some(crate::world::ModuleProvenance::Artifact),
guest,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the publisher trust decision for builder installs

When a builder installs a module signed by a configured trusted publisher, this call loses the admission decision: WorldHandle::install_program_authorized hardcodes trust: None, which the actor copies into the durable ProgramInstalled event. Unlike the existing admin installer, the new path therefore journals neither SignatureVerified nor the publisher key, even though it verified the signature. That leaves journal/history consumers unable to establish which publisher authorized the installed artifact. Derive the same TrustDecision as the admin upload path and carry it through the capability-authorized install command.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cdd39d5 (head now 6f28758, which also merges current main).

WorldHandle::install_program_authorized no longer hardcodes trust: None: it takes the caller's TrustDecision and carries it through InstallProgramAuthorized into the durable ProgramInstalled event. WorldService::install_wasm_authorized derives the same decision as the admin upload path — SignatureVerified with the publisher key when a trust list is configured, NoTrustList when none is — immediately after the same verify_module_signature gate.

Coverage: tests/world_roles asserts the authorized install journals the supplied decision in the Committed/ProgramInstalled event; a new world_session test has a joined builder install a trusted signer's module and asserts SignatureVerified + publisher in the journal, and the existing builder install test now also asserts the NoTrustList decision is recorded.

Comment thread pkgs/id/src/world_session/mod.rs Outdated
Comment on lines +825 to +826
.await
.map_err(|_| InstallError::Unavailable)?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve actor-denied errors from the final authorization check

If the builder capability expires or a queued revocation executes between the preceding authorize command and install_program_authorized, the actor correctly refuses activation, but this mapping converts that authorization denial into Unavailable. The session then emits an activation failure without the promised actor_denied code. The moderator path has the same race between its preliminary check and revoke_authorized, whose denial becomes an uncoded revoke failed error. Classify authorization failures returned by the operation commands themselves, rather than relying on a separate preliminary check, so final-boundary denials retain the stable wire code.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cdd39d5 (head now 6f28758, which also merges current main).

Classification now comes from the operation commands' own errors: capability denials in the world core are typed (world::CapabilityDenied; the non-oracular messages are unchanged), and the session classifies the errors returned by install_program_authorized and revoke_authorized via world::is_capability_denied. A denial at the final boundary — capability expired, or a revocation landed, after the preliminary authorize check — therefore keeps the actor_denied wire code on both paths; non-denial failures (journal/actor errors) keep their existing uncoded failure replies. The preliminary check remains only as the early, pre-upload classification.

Coverage: tests/world_roles asserts both commands' denials are classifiable (is_capability_denied) from the returned error; the existing session test for a builder revoked mid-upload still passes, and the full pkgs/id lib suite passes except the pre-existing #8354 failure (fails identically on pristine main).

@dezren39

Copy link
Copy Markdown
Member Author

state: parked (Codex findings block merge — fix is the resume step)
task 14374 (small_fix) — issue #8036 / PR #8494 — lane tmp-code-y, 2026-11-11

State advanced past the last checkpoint: the prior uncommitted implementation was committed as 0ae5e39 on branch queue/14374-8036-joined-frames and PR #8494 is OPEN. Re-verified fresh this shift: issue #8036 OPEN, no hard-stop labels, no status/needs-triage; PR head matches the Codex-reviewed commit. CI rollup: 11 QUEUED, 1 SUCCESS, 1 SKIPPED, 1 NEUTRAL.

Codex gate (§5) — BLOCKS MERGE: the Codex review on commit 0ae5e39 completed with has_any_findings=true, has_unresolved_findings=true. Three P2 findings, all read as valid on inspection:

  1. pkgs/id/contract/shell-contract.v1.json (conformance, src/shell_contract.rs): Conformance::client stays in Phase::Joined after a joined install_begin — it only applies a frame's opens transition in Phase::Opening — so install_chunk/install_end are rejected and check_contract rejects transcripts from the new flow. Fix: enter the upload phase from a joined session and return to joined (not closed) when the upload ends.
  2. pkgs/id/src/world_session/mod.rs:823: WorldHandle::install_program_authorized hardcodes trust: None, so the durable ProgramInstalled event journals neither SignatureVerified nor the publisher key for a trusted-publisher builder install. Fix: derive the same TrustDecision as the admin upload path and carry it through the capability-authorized install command.
  3. pkgs/id/src/world_session/mod.rs:826: authorization denials returned by install_program_authorized / revoke_authorized themselves are mapped to Unavailable / an uncoded "revoke failed", losing the stable actor_denied wire code when the capability expires or a queued revocation lands between the preliminary authorize and the operation. Fix: classify authorization failures from the operation commands, not only the preliminary check.

Terminal for this shift: task 14374 parked. Resume: fix all three findings on branch queue/14374-8036-joined-frames (worktree /home/user/git/fleet/queue-14374-8036-joined-frames), run the pkgs/id cargo tests, push, disposition each Codex thread on PR #8494, then merge on green CI and complete task 14374 / close issue #8036.

repo-worker-tmp-code-b added 2 commits November 10, 2026 23:19
- shell contract conformance: a joined install_begin enters the
  upload phase and install_end (or a refusal) returns to joined,
  not closed, so conformance accepts the newly supported flow.
- authorized install: derive the publisher trust decision in the
  session path and carry it through install_program_authorized
  into the durable ProgramInstalled event, as the admin path does.
- actor_denied classification: capability denials from the world
  core are typed (CapabilityDenied); the session classifies the
  operation commands own errors (install_program_authorized,
  revoke_authorized) so final-boundary denials keep the wire code.

Tests: world_roles (trust carried + denial classification),
world_session (mid-upload revocation still actor_denied; signed
builder install journals SignatureVerified + publisher; unsigned
records NoTrustList), shell_contract (joined upload conformance).
…ed-frames

# Conflicts:
#	pkgs/id/src/world_session/mod.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

id: implement design #835 phase 3 — joined-session builder/moderator frames

1 participant